import { sequelize } from './sequelize.js'
import { User } from "../model/User.js"

//同步模型到数据库
export const sync = async () => {
    try {
        await sequelize.authenticate();  //验证数据库是否连接正常
        console.log("数据库连接正常");
    } catch (error) {
        console.log("数据库连接失败 error", error);
    }
    await sequelize.sync();  //调用sequelize实例的dataBase方法
    console.log("数据库初始化成功");

    await User.sync();
}